cmake_minimum_required(VERSION 3.20)

project(yingce VERSION 1.0 LANGUAGES CXX)

# Force C++ standard, do not fall back, do not use compiler extensions
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

set(CMAKE_INCLUDE_CURRENT_DIR ON)

# Set up Qt stuff:
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)

find_package(Qt6 COMPONENTS Core)

if (Qt6_VERSION VERSION_GREATER_EQUAL 6.7.0)
    qt_standard_project_setup(I18N_TRANSLATED_LANGUAGES en_US zh_CN)
endif()

if (Qt6_VERSION VERSION_LESS 6.0.0)
  # Specify standards conformance mode to MSVC 2017 and later
  # Qt6 has the values as part of the Qt6::Platform target interface
  if (MSVC AND MSVC_VERSION GREATER_EQUAL 1910)
    add_compile_options(/permissive- /Zc:__cplusplus)
  endif()
  if (CMAKE_CXX_COMPILER_ID STREQUAL GNU)
    add_compile_options(-Wno-missing-field-initializers)
  endif()
else()
  # Common intermediate directory for QML modules which are defined via qt_add_qml_module()
  set(QT_QML_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/qml_modules")

  # This includes the code that will enable higher compiler warnings level (/W3 for MSVC, -Wall -Wextra for GCC)
  # This is controlled by QT_COMPILE_OPTIONS_DISABLE_WARNINGS target property.
  include(QtCompilerFlags)
endif()

add_subdirectory(src)
